package com.example.dqdq.lzyim_asm_tvapp;

import android.content.Context;
import android.graphics.PixelFormat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;

import com.example.dqdq.lzyim_asm_tvapp.utils.ActivityCollector;
import com.umeng.analytics.MobclickAgent;

public class Ad_view_Activity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ActivityCollector.addActivity(this);

        showText();
    }
    private WindowManager wm;
    private void showText() {
        wm = (WindowManager) Ad_view_Activity.this.getSystemService(Context.WINDOW_SERVICE);

        LayoutInflater inflater = LayoutInflater.from(Ad_view_Activity.this);

        View subtitleView = inflater.inflate(R.layout.ad_img5_layout, null);

        WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
        lp.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;

        lp.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
        lp.format = PixelFormat.TRANSPARENT;
        lp.width = 1000;
        lp.height = 700;
        lp.gravity = Gravity.CENTER_VERTICAL;

        wm.addView(subtitleView, lp);
    }

    public void onResume() {
        super.onResume();
        MobclickAgent.onResume(this);
    }
    public void onPause() {
        super.onPause();
        MobclickAgent.onPause(this);
    }
    
    @Override
    protected void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        ActivityCollector.removeActivity(this);
    }
}
